function alertForm(layer, paging, title, content, area, url, data, options) {
    layer.open({
        type: 1,
        title: title,
        content: content,
        btn: ['保存', '取消'],
        area: area,
        maxmin: true,
        yes: function (index) {
            var param=new Object();
            for(var key in data){
                param[data[key]] = $('#'+data[key]).val();
            }
            $.ajax({
                type: "POST",
                url: url,
                data:  param,
                async: true,
                beforeSend: function () {
                    jz = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
                },
                error: function (request) {
                    layer.close(jz);
                    layer.alert('网络错误',{icon:2}, function(index){
                        layer.close(index);
                    });
                },
                success: function (data) {
                    //关闭加载层
                    layer.close(jz);
                    if (data.code == 1) {
                        layer.msg(data.msg, {
                            icon: 1,
                            time: 1500
                        }, function(){
                            paging.get({
                                pageIndex: 1,
                                pageSize: 14,
                                options: options
                            });
                        });
                        layer.close(index);
                    } else if(data.code == -1){
                        window.location.href = '/admin/login/login';
                    }else {
                        layer.alert(data.msg);
                    }
                }
            });
        }
    });
}


function alertFormNotLoad(layer, title, content, area, url, data){
    layer.open({
        type: 1,
        title: title,
        content: content,
        btn: ['保存', '取消'],
        area: area,
        maxmin: true,
        yes: function (index) {
            var param=new Object();
            for(var key in data){
                param[data[key]] = $('#'+data[key]).val();
            }
            $.ajax({
                type: "POST",
                url: url,
                data:  param,
                async: true,
                beforeSend: function () {
                    jz = layer.load(0, {shade: false}); //0代表加载的风格，支持0-2
                },
                error: function (request) {
                    layer.close(jz);
                    layer.alert('网络错误',{icon:2}, function(index){
                        layer.close(index);
                    });
                },
                success: function (data) {
                    //关闭加载层
                    layer.close(jz);
                    if (data.code == 1) {
                        layer.msg(data.msg, {
                            icon: 1,
                            time: 1500
                        }, function(){
                           window.location.reload();
                        });
                        layer.close(index);
                    } else if(data.code == -1){
                        window.location.href = '/admin/login/login';
                    }else {
                        layer.alert(data.msg);
                    }
                }
            });
        }
    });
}